package com.solocredit.finance.config

import com.solocredit.finance.app.MyApp
import com.solocredit.finance.utils.helper.SharedHelper
import com.solocredit.finance.utils.language.LocaleContract
import com.solocredit.finance.utils.language.MultiLanguages
import org.json.JSONObject


/**
 * MullaFlow
 * @Author wwdeng
 * @CreateTime: 2024/7/4 19:25
 * @Annotation：APP 配置文件
 */
object MullaConfigs {

    /**
     * APP 名称
     */
    const val MULLA_APPNAME = "FLEXIMOLA"

    /**
     * 包名
     */
    const val MULLA_PACKAGENANME = "com.FlexiMola.safeloans.fastpacedapp"

    /**
     * 加解密
     */
    const val MULLA_AES_KEY = ""
    const val MULLA_AES_IV = ""

    /**
     * Adjust
     */
    const val MULLA_ADJ_TOKEN = "s9pn146eglc0"
    const val MULLA_ADJ_EVENT_REGISTER = "udpdqp"
    const val MULLA_ADJ_EVENT_APPLY = "w0ydtx"

    /**
     * 缓存首页点击的产品信息 - 仅在进件信息完成后直接进入申贷页使用
     */
    var clickProductLogo = ""
    var clickProductName = ""
    var clickProductToken = ""
    var clickProductTitle = ""

    /**
     * 是否是法语地区
     *  desc：地区转发（timeZone） 以 fcfa、xaf、senegal、benin 结尾，则定义为法语地区
     */
    fun isFrench(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("fcfa") || timeZone.endsWith("xaf") || timeZone.endsWith("senegal") || timeZone.endsWith("benin")
    }

    /**
     * 加纳 233
     */
    fun isGha(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("gha")
    }

    /**
     * 肯尼亚 254
     */
    fun isKsh(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("ksh")
    }

    /**
     * 乌干达 256
     */
    fun isUgx(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("ugx")
    }

    /**
     * 科特迪瓦 225
     */
    fun isFcfa(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("fcfa")
    }

    /**
     * 喀麦隆  237
     */
    fun isXaf(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("xaf")
    }

    /**
     * 赞比亚 	260
     */
    fun isZmb(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("zmb")
    }

    /**
     * 塞内加尔  221
     */
    fun isSenegal(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("senegal")
    }

    /**
     * 坦桑尼亚  255
     */
    fun isTanz(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("tanz")
    }

    /**
     * 贝宁  229
     */
    fun isBenin(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("benin")
    }

    /**
     * 莫桑比克
     */
    fun isMoz(): Boolean{
        val timeZone = SharedHelper.getMullaSPString(SharedHelper.MULLA_SPKEY.MULLA_TIMEZONE)
        return timeZone.endsWith("moz")
    }

    /**
     * 是否是斯瓦西里语
     */
    fun isSwahili(): Boolean{
        if (isTanz()) {
            val curtLocale = MultiLanguages.getAppLanguage(MyApp.app.getAppContext())
            when (curtLocale.language) {
                LocaleContract.getSwahiliLocale().language -> {//坦桑
                    return true
                }
            }
        }
        return false
    }
}